home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
System Booster
/
System Booster.iso
/
Systemmonitors
/
TaskE
/
Source
/
winhand.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-09-26
|
4KB
|
150 lines
/*
* Copyright (c) 1993 Michael D. Bayne.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that
* the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use of this software must display the following
* acknowledgement:
*
* This product includes software developed by Michael D. Bayne.
*
* 4. My name may not be used to endorse or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY MICHAEL D. BAYNE ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL MICHAEL D. BAYNE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <exec/execbase.h>
#include <exec/memory.h>
#include <intuition/intuitionbase.h>
#include <intuition/screens.h>
#include <libraries/gadtools.h>
#include <dos/dos.h>
#include "TaskE.h"
#include "TaskE_rev.h"
#include "defs.h"
extern struct List *taskList, *scrList;
extern struct TagItem Tags[];
extern ULONG killMode;
int TASKLClicked( void )
{
ULONG num;
struct TaskNode *t;
for( t = ( struct TaskNode * )taskList->lh_Head, num = 0; num != TaskEMsg.Code; num++,
t = ( struct TaskNode * )t->tn_Node.ln_Succ );
switch( num = rtEZRequest( "Name: %s\nPriority: %02d\nAddress: 0x%08lx\nSigAlloc: 0x%08lx\nSigWait: 0x%08lx",
"Send _Break|_Remove Task|_Cancel", 0L, ( struct TagItem * )Tags, t->tn_Name, t->tn_Node.ln_Pri, t->tn_TaskAddress,
t->tn_SigAlloc, t->tn_SigWait )) {
case 1:
sendSigAbrt( t );
if( TaskExists( t->tn_TaskAddress ))
rtEZRequest( "Task did not exit.", "_Ok", 0L, ( struct TagItem * )Tags );
else {
rtEZRequest( "Task exited succesfully.", "_Ok", 0L, ( struct TagItem * )Tags );
GT_SetGadgetAttrs( TaskEGadgets[GD_TASKL], TaskEWnd, 0l, GTLV_Labels, 0L, TAG_DONE );
Remove(( struct Node * )t );
FreeMem( t, sizeof( struct TaskNode ));
GT_SetGadgetAttrs( TaskEGadgets[GD_TASKL], TaskEWnd, 0l, GTLV_Labels, taskList, TAG_DONE );
}
break;
case 2:
if( TaskExists( t->tn_TaskAddress )) RemTask(( struct Task * )t->tn_TaskAddress );
GT_SetGadgetAttrs( TaskEGadgets[GD_TASKL], TaskEWnd, 0l, GTLV_Labels, 0L, TAG_DONE );
Remove(( struct Node * )t );
FreeMem( t, sizeof( struct TaskNode ));
GT_SetGadgetAttrs( TaskEGadgets[GD_TASKL], TaskEWnd, 0l, GTLV_Labels, taskList, TAG_DONE );
killMode = rtEZRequest( "Phew. Task successfully removed.", "Remove _Window|Remove _Screen|_Ok", 0L, Tags );
break;
}
return( 1 );
}
int REBOOTClicked( void )
{
ColdReboot();
return( 0 );
}
int UPDATEClicked( void )
{
getTasks( taskList );
return( 1 );
}
int SCREENLClicked( void )
{
popScreen( TaskEMsg.Code );
return( 1 );
}
int TaskEABOUT( void )
{
rtEZRequest( VSTRING"\nFree Software from Michael D. Bayne", "_Ok", 0L, ( struct TagItem * )Tags );
return( 1 );
}
int TaskEQUIT( void )
{
return( 0 );
}
int TaskEKWND( void )
{
killMode = WINDOW;
return( 1 );
}
int TaskEKSCR( void )
{
killMode = SCREEN;
return( 1 );
}
int TaskECloseWindow( void )
{
return( 0 );
}
int TaskEActiveWindow( void )
{
getScreens( scrList );
return( 1 );
}
int TaskEVanillaKey( void )
{
switch( TaskEMsg.Code ) {
case 'U':
case 'u':
return( UPDATEClicked() );
case 'R':
case 'r':
return( REBOOTClicked() );
case 27: /* ESC */
return( 0 );
}
}